import request from '@/utils/request'
// 获取网关列表
export function getGatewayList(query) {
  return request({
    url: `/gateway/list`,
    method: 'get',
    params: query
  })
}
// 获取最近更新的网关列表
export function getGatewayLastList(query) {
  return request({
    url: `/gateway/last_list`,
    method: 'get',
    params: query
  })
}
export function getGatewayListWb(query) {
  return request({
    url: `/gateway/list_wb`,
    method: 'get',
    params: query
  })
}
// 用户根据OTA任务id获取详情
export function getGatewayListByMAC(query) {
  return request({
    url: `/gateway/gw_wb`,
    method: 'get',
    params: query
  })
}
// 用户根据OTA任务id获取详情
export function getGatewayByMac(mac) {
  return request({
    url: `/gateway/${mac}`,
    method: 'get',
  })
}
// 根据网关mac获取RSSI>-70的手环数据
export function getWristbandAdvById(query) {
  return request({
    url: `/wristband_adv/list`,
    method: 'get',
    params: query
  })
}

// 网关配置手环
export function createGatewayWristband(data) {
  return request({
    url: '/wristband_adv/gateway_wristband',
    method: 'post',
    data: data
  })
}

// 获取网关配置的手环列表
export function getGatewayWristband(data) {
  return request({
    url: `/gateway_wristband/${id}`,
    method: 'get',
  })
}

// 更新网关
export function updateGagewayByMac(data){
  return request({
    url: `/gateway/update/${data.mac}`,
    method: 'put',
    data: data
  })
  
}



// 给班级分配多个网关（即网关-班级关联） 多对一
export function setGwClass(data){
  return request({
    url: '/gateway/setGwClass',
    method: 'post',
    data: data
  })
}

// 删除网关
export function deleteGwByMac(mac){
  return request({
    url: `/gateway/delete/${mac}`,
    method: 'delete',
  })
}